#!/usr/bin/perl -w

while(<STDIN>) {
  if(/\|\s*\[\[([^\|]+)(\|[^\]]+)?\]\]/) {
    print "$1\n";
  }
}